package com.tac.controller.mes;

import com.github.pagehelper.PageInfo;
import com.tac.common.result.Result;
import com.tac.pojo.mes.DeviceInformation;
import com.tac.pojo.wms.TransferInformation;
import com.tac.service.mes.DeviceInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/deviceInformation")
@CrossOrigin
@Api(tags = "制作执行MES--设备信息接口")//已完成
public class DeviceInformationController {

    @Autowired
    private DeviceInformationService deviceInformationService;


    //设备信息查询
    @ApiOperation("设备信息查询")
    @GetMapping("/getList")
    public Result<PageInfo<DeviceInformation>> getList(Integer pageNum, Integer pageSize, String name, String code, String model, @DateTimeFormat(pattern = "yyyy-MM-dd") Date produceDateStart, @DateTimeFormat(pattern = "yyyy-MM-dd") Date produceDateEnd, String productBatch, String manufacturer, String deviceStatus ){
       return deviceInformationService.getList(pageNum,pageSize,name,code,model,produceDateStart,produceDateEnd,productBatch,manufacturer,deviceStatus);
    }
    //设备信息添加
    @ApiOperation("设备信息添加")
    @PostMapping("/save")
    public Result save(@RequestBody DeviceInformation deviceInformation){
        return deviceInformationService.save(deviceInformation);
    }
    //设备信息删除
    @ApiOperation("设备信息删除")
    @DeleteMapping("/remove")
    public Result remove(@RequestBody List<Integer> ids){
        return deviceInformationService.remove(ids);
    }
    //设备信息更新
    @ApiOperation("设备信息更新")
    @PutMapping("/update")
    public Result update(@RequestBody DeviceInformation deviceInformation){
        return deviceInformationService.update(deviceInformation);
    }
}
